<template>
  <border-box title="任务信息">
    <a-row type="flex" class="item">
      <a-col v-bind="labelCol" class="label">任务编号：</a-col>
      <a-col flex="auto" class="value">{{info.taskNo}}</a-col>
    </a-row>
    <a-row type="flex" class="item">
      <a-col v-bind="labelCol" class="label">发起人：</a-col>
      <a-col flex="auto" class="value">{{info.createBy}}</a-col>
    </a-row>
    <a-row type="flex" class="item">
      <a-col v-bind="labelCol" class="label">创建时间：</a-col>
      <a-col flex="auto" class="value">{{info.createTime}}</a-col>
    </a-row>
    <a-row type="flex" class="item">
      <a-col v-bind="labelCol" class="label">任务名称：</a-col>
      <a-col flex="auto" class="value">{{info.taskName}}</a-col>
    </a-row>
<!--    <a-row type="flex" class="item">-->
<!--      <a-col v-bind="labelCol" class="label">所属主题：</a-col>-->
<!--      <a-col flex="auto" class="value">{{info.themeName||'无'}}</a-col>-->
<!--    </a-row>-->
    <a-row type="flex" class="item">
      <a-col v-bind="labelCol" class="label">优先级：</a-col>
      <a-col flex="auto" class="value">{{getUrgencyLevelName(info.urgencyLevel)}}</a-col>
    </a-row>
    <a-row type="flex" class="item">
      <a-col v-bind="labelCol" class="label">截止时间：</a-col>
      <a-col flex="auto" class="value">{{info.endTime||'无截止时间'}}</a-col>
    </a-row>
    <a-row type="flex" class="item">
      <a-col v-bind="labelCol" class="label">任务备注：</a-col>
      <a-col flex="auto" class="value">{{info.remark||'无'}}</a-col>
    </a-row>
  </border-box>
</template>

<script>
  //任务信息：任务基本信息
  import BorderBox from "./BorderBox";
  import {getAction} from "../../api/manage";

  export default {
    name: "TaskBaseInfo",
    components: {BorderBox},
    props: ['params'],
    data() {
      return {
        labelCol: {sm:15,md:12,lg:9,xl:6},
        info: {}
      }
    },
    created() {
      this.fetchBaseInfo();
    },
    methods: {
      getUrgencyLevelName(level){
        return {
          '0':'一般',
          '1':'重要',
          '2':'紧急'
        }[level]
      },
      fetchBaseInfo() {
        getAction('task/taskInfo/queryTaskInfo', this.params).then(res => {
          if (res.success) {
            this.info = res.result;
          } else {
            console.log(res.message);
          }
        })
      }
    }
  }
</script>

<style scoped>
  .item {
    flex-flow: unset;
    padding: 10px 0;
    font-size: 14px;
  }

  .label {
    color: rgba(0, 0, 0, .85);
    text-align: right;
  }

  .value {
    color: rgba(0, 0, 0, .65);
  }
</style>